/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.reg;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>Project: jse2302 - Ex8
 * <p>Powered by webrx On 2023-06-21 15:39:13
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex8 {
    public static void main(String[] args) {
        String str = "-0000120h-65e99llo-1234";
        Pattern p = Pattern.compile("-?[1-9]\\d+");
        Matcher m = p.matcher(str);
        int sum = 0;
        while (m.find()) {
            String s = m.group();
            int i = Integer.parseInt(s);
            sum += i;
        }
        System.out.println(sum);


    }
}
